package model

import "config"

type UserRelation struct {
	ID      int    `json:"id"`
	FromUid int    `json:"formUid"`
	ToUid   int    `json:"toUid"`
	Type    int8   `json:"type"` //1好友关系 -1已删除 -2已拉黑
	Time    int    `json:"time"`
	RoomID  string `json:"room_id"` //房间号
}

func CheckUserRelation(fromUid int, toUid int) (relation UserRelation, err error) {
	err = config.Db.QueryRow("SELECT id,from_uid,to_uid,time,type,room_id  FROM user_relation WHERE from_uid = ? AND to_uid = ?", fromUid, toUid).Scan(&relation.ID, &relation.FromUid, &relation.ToUid, &relation.Time, &relation.Type, &relation.RoomID)
	return
}
